package android.view;


/**
 * base point of the pen-write.
 * must read only.
 * 20200320：chang x/y/radus/press/speed to float. --the view pw rect is int,
 * and we need the MotionEvent X/Y fix to int,so change x/y to int.
 * 20200401: 1. 去掉不必要的 speed参数； 2. 对比 float类型的 radus和int类型无差别，
 * 为了提高效率，改为 int 型； 3. 由于speed不需要，所以 eventTime实际也不需要，只有
 * 需要真实还原回放笔迹的情况下才需要。目前还不支持真实回放，可以去掉(去掉后可以支持恒速
 * 回放）--我们尽量减少手写的时候需要的数据空间和处理.
 */
public class PWInputPoint {
	public static final String TAG = "PWInputPoint";

	public  int                 x;
	public  int                 y;
	public  int 				action;

	public  float				press;
	//public  float		        speed;

	// the time after event-down.unit is ms.
	//public  int  				eventTime;

    // 20200326: force to use getRadus/setRadus to access.
    // 20200401: 为了处理方便，提高效率，采用 int 数据类型.
    protected  int 		        radus;

    // 20200403: 有些场合需要知道 point 是否移动，为了节省空间，此处增加 repeat count.
    public int                  repeat;

    public  boolean	            erasing;

    // 20200409: 用于 draw object 不同的 obj 进行 repaint 的参数.其他部分参数有 OBJ 自己定义。
    //public static final int     OBJFLAG_REPAINT = (0x01<<0);

    //public int                  objflag;

    // 20200320: not use know.
	//public static final int 	SpeedScale = 1000;
	//public static final int		PressScale = 2048;

	public PWInputPoint() {
		Invalid();
	}

	public float getSpeed() {
		return 0.0f; //speed;
	}

	public int getRadus() {
		return radus;
	}

	public int getAction() {
		return action;
	}

	public float getPress() {
		return press;
	}

	public boolean getErase() {
		return erasing;
	}

	public int getEventTime() {
		return 0; //eventTime;
	}

	 // 20170627,overwirte the super to reset the speed and distance.
	 public void Invalid() {
        radus = -1; // 0.0f;  // if radus !=0 ,we don't need to call setPenAdjustRadius.
        //eventTime = 0; // 20180319,this is emulating point flag.
        //press = 0.0f;
        repeat = 0;
    }

	 public PWInputPoint getNext() {
		 return null;
	 }

	 public PWInputPoint getPrev() {
		 return null;
	 }

	 public void setRadus(float radus) {
		this.radus = (int)(radus+0.5f);
	 }

	 public void setRadus(int radus) {
		this.radus = radus;
	 }

    // 20200424: hsl add.
    public int getFixRadus() {
		int r = radus;
		if(r < 2) {
			r = 0;
		}
		return r;
	 }

     // 20200401: add with Invalid changed.
	 public boolean isRadusSet() {
	    return radus >= 0;
	 }
}

